<?php

namespace Acme\DemoBundle\Entity;

use Symfony\Component\Validator\Constraints as Assert;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * Acme\DemoBundle\Entity\Category
 *
 * @ORM\Table()
 * @ORM\Entity
 */
class Category
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string $name
     * 
     * @ORM\Column(name="name", type="string", length=100)
     */
    private $name;

    /**
     * @var integer $parent
     * 
     * @ORM\Column(name="parent", type="integer")
     */
    private $parent;
	
	/**
	 *
	 * @ORM\OneToMany(targetEntity="Newss", mappedBy="category")
	 *
	 */
	public $newss;

	/**
     * Constructor
    */
	public function __construct()
    {
        $this->newss = new ArrayCollection();
    }
	
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set parent
     *
     * @param integer $parent
     */
    public function setParent($parent)
    {
        $this->parent = $parent;
    }

    /**
     * Get parent
     *
     * @return integer 
     */
    public function getParent()
    {
        return $this->parent;
    }

    /**
     * Add newss
     *
     * @param Acme\DemoBundle\Entity\Newss $newss
     */
    public function addNewss(\Acme\DemoBundle\Entity\Newss $newss)
    {

		$newss->setCat($this->getId());
        $this->newss[] = $newss;
    }

    /**
     * Get newss
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getNewss()
    {
        return $this->newss;
    }
}